package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.annotation.CacheSync;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.entity.DishFlavor;
import com.sky.entity.Employee;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * 批量插入数据
     *
     * @param flavors
     */
    @CacheSync
    void insertBatch(List<DishFlavor> flavors);

    /**
     * 根据dish清理菜品口味表
     *
     * @param dishId
     */
    @CacheSync
    @Delete("delete from dish_flavor where dish_id =#{id}")
    void deleteByDishId(long dishId);

    /**
     * 根据dishIds删除菜品口味表
     * @param ids
     */
    @CacheSync
    void deleteByDishIds(List<Long> ids);

    /**
     * 根据dishId查询口味集合
     * @param id
     * @return
     */
    // @AutoFill(OperationType.INSERT)
    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getByDishId(Long id);
}
